package dom.xpath.io;

import java.io.File;
import dom.xpath.core.Prop;
import dom.xpath.util.Token;

/**
 * Input/Output Constants.
 *
 * @author Workgroup DBIS, University of Konstanz 2005-07, ISC License
 * @author Christian Gruen
 */
public final class IOConstants {
  /** Chopped output notice. */
  static final byte[] RESULTCHOP = Token.token("\n...output was chopped.");
  /** BlockSize Power. */
  public static final int BLOCKPOWER = 12;
  /** Table NodeSize Power. */
  public static final int NODEPOWER = 4;
  /** Fill Factor (greater than 0.0, maximum 1.0). */
  public static final double BLOCKFILL = 1;

  /** Private Constructor. */
  private IOConstants() { }
  
  /**
   * Adds the database suffix to the specified filename and creates
   * a file instance.
   * @param db name of the database
   * @param file filename
   * @return database filename
   */
  public static File dbfile(final String db, final String file) {
    return new File(Prop.dbpath + '/' + db + '/' + file + ".basex");
  }
  
  /**
   * Returns a file instance for the current database path.
   * @param db name of the database
   * @return database filename
   */
  public static File dbpath(final String db) {
    return new File(Prop.dbpath + '/' + db + '/');
  }
}
